package com.hyfd.controller.mp;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hyfd.controller.sys.BaseController;
import com.hyfd.service.mp.ProviderBillDiscountSer;

@Controller
//@Scope("prototype") //开启非单例模式 用于并发控制
public class ProviderBillDiscountCtl extends BaseController{
	
	@Autowired
	ProviderBillDiscountSer providerBillDiscountSer;
	
    @GetMapping("providerBillDiscountEditPage/{id}")
	public String providerBillDiscountEditPage(HttpServletRequest req,@PathVariable("id") String id) {
		return providerBillDiscountSer.providerBillDiscountEditPage(req,id);
	}
  
	@GetMapping("providerBillDiscountByBillPkgId/{bill_pkg_id}")
	@ResponseBody
	public String providerBillDiscountByBillPkgIdGet(@PathVariable("bill_pkg_id") String bill_pkg_id) {
		return providerBillDiscountSer.getProviderBillDiscountByBillPkgId(bill_pkg_id);
	}
	
	@GetMapping("providerBillDiscountByBillPkgIdAndProvinceCode")
	@ResponseBody
	public String providerBillDiscountByBillPkgIdAndProvinceCodeGet(HttpServletRequest req) {
		return providerBillDiscountSer.getProviderBillDiscountByBillPkgIdAndProvinceCode(req);
	}
  	
	@PostMapping("providerBillDiscount")
	@ResponseBody
	public String providerBillDiscountPost(HttpServletRequest req) {
		return providerBillDiscountSer.providerBillDiscountAdd(req);
	}
	
	@PutMapping("providerBillDiscount/{id}")
	@ResponseBody
	public String providerBillDiscountPut(@PathVariable("id") String id, HttpServletRequest req) {
		return providerBillDiscountSer.providerBillDiscountEdit(req, id);
	}

	@PostMapping("providerBillDiscountEx1")
	@ResponseBody
	public String providerBillDiscountEx1Post(HttpServletRequest req) {
		return providerBillDiscountSer.providerBillDiscountUpload(req);
	}
	
	/**
	 * <h5>功能描述:</h5>	跳转到运营商话费折扣列表展示页面
	 *
	 * @param id
	 * @param req
	 * @return
	 *
	 * @作者：zhangpj		@创建时间：2017年5月10日
	 */
	@GetMapping("providerBillDiscountListPage/{id}")
	public String providerBillDiscountListPage(@PathVariable("id") String id,HttpServletRequest req) {
		return providerBillDiscountSer.providerBillDiscountListPage(id,req);
	}
	
	/**
	 * 获取运营商话费折扣列表数据 只能使用get方式提交
	 * @param req
	 * @return
	 */
	@GetMapping("providerBillDiscount")
	@ResponseBody
	public String providerBillDiscountGet(HttpServletRequest req) {
		return providerBillDiscountSer.providerBillDiscountList(req);
	}
	
	/**
	 * <h5>功能描述:</h5>	添加运营商流量包折扣信息
	 *
	 * @param req
	 * @param provincesAndDiscountes
	 * @return
	 *
	 * @作者：zhangpj		@创建时间：2017年3月31日
	 */
	@PostMapping("providerBillDiscountEdit")
	@ResponseBody
	public String providerBillDiscountAddPost(HttpServletRequest req) {
		return providerBillDiscountSer.providerBillDiscountEditExt(req);
	}
	
	/**
	 * @功能描述：	折扣设置页面获取满足条件的话费包折扣信息
	 *
	 * @作者：zhangpj		@创建时间：2017年5月16日
	 * @param req
	 * @return
	 */
	@GetMapping("providerBillDiscountInfo")
	@ResponseBody
	public String providerDataDiscount(HttpServletRequest req) {
		return providerBillDiscountSer.selectProviderBillDiscount(req);
	}
}
